package edu.sandau.b230111.b23011121.service;

import edu.sandau.b230111.b23011121.model.Teacher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Component;
import edu.sandau.b230111.b23011121.respository.TeacherRepository;

import java.util.List;

@Component
public class TeacherService {

    @Autowired
    private TeacherRepository teacherRepository;

    public List<Teacher> findAll(Teacher teacher){
        return teacherRepository.findAll(Example.of(teacher));
    }

    public void deleteById(String id) {
        teacherRepository.deleteById(id);
    }

    public void save(Teacher s) {
        teacherRepository.save(s);
    }

    public Teacher getReferenceById(String id) {
        return teacherRepository.getReferenceById(id);
    }
}
